将这个学生成绩管理系统[C语言]不用链表而用结构体数组实现

来源:百度知道 编辑:UC知道 时间:2024/05/18 10:54:16
#define N 10
struct scorenode
{int number;
char name[10];
float yuwen;
float yingyu;
float shuxue;
float save;
}score[N];
int n,k;
void input(struct scorenode *p)
{
struct scorenode *p1,*p2,*p3,*max,*head;
int i,j;
float fen;
char t[10];
FILE *fp;
char filepn[20];
n=0;
head=p;
p1=p2=p3=head;
printf("学生资料,0退出!\n");
repeat1: printf("输入学生学号:");
scanf("%d",&p1->number);
if(p1->number==0)
goto end;
else
{
p3=head;
if(n>0)
{if(p1->number!=p3->number)
p3++;
else
{printf("重复,重输!\n");
goto repeat1;
}
}
}
}
printf("姓名:");
scanf("%s",&p1->name);
printf("语文成绩:");
scanf("%f",&p1->yuwen);
while(p1->yuwen<0||p1->yuwen>100)
{getchar();
printf("错误,重输入&quo

看看我变得这个,希望对你有所启发
/* Note:Your choice is C IDE */
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "ctype.h"
#include "math.h"

#define N 3 /*这是总的学生数,你可以想多少就多少*/

char name[N][20];
int i,num[N];
float yuwen[N],shuxue[N],yingyu[N];

int input()
{
for(i=0;i<N;i++)
{
printf("请输入第[%d]学生的姓名\n",i+1);
scanf("%s",name[i]);
printf("请输入第[%d]学生的学号\n",i+1);
scanf("%d",&num[i]);
printf("请输入第[%d]学生的语文成绩\n",i+1);
scanf("%f",&yuwen[i]);
printf("请输入第[%d]学生的数学成绩\n",i+1);
scanf("%f",&shuxue[i]);
printf("请输入第[%d]学生的英语成绩\n",i+1);
scanf("%f",&yingyu[i]);
}
return(i);
}

void sort1()
{
int n;
float t;
int i,j;
char a[10];
for(i